package it.antonio.ilpizze.aop;

import java.lang.annotation.Annotation;

import it.antonio.ilpizze.aop.advice.AndAdvice;
import it.antonio.ilpizze.aop.pointcut.AllMethodsPointcut;
import it.antonio.ilpizze.aop.pointcut.AndPointcut;
import it.antonio.ilpizze.aop.pointcut.AnnotatedMethodPointcut;
import it.antonio.ilpizze.aop.pointcut.MethodNamePointcut;
import it.antonio.ilpizze.aop.pointcut.OrPointcut;

public abstract class Aspect {
	public Pointcut pointcut(){
		return allMethods();
	}
	public abstract Advice advice();
	
	
	protected Advice and(Advice...advices){
		return new AndAdvice(advices);
	}
	
	protected Pointcut and(Pointcut...pointcuts){
		return new AndPointcut(pointcuts);
	}
	protected Pointcut or(Pointcut...pointcuts){
		return new OrPointcut(pointcuts);
	}
	
	protected Pointcut allMethods(){
		return new AllMethodsPointcut();
	}
	protected Pointcut methodsWithName(String name){
		return new MethodNamePointcut(name);
	}
	protected Pointcut methodsAnnotatedWith(Class<? extends Annotation> ann){
		return new AnnotatedMethodPointcut(ann);
	}
}
